<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>字面量定义类和使用</title>
    <style>
        div{
            margin: 0 auto;
            width: 300px;
            height: 300px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div>

    </div>
</body>
<script>
    //定义person
    let person = {
        name : "张三",
        age : 23,
        hobby : ["听课","学习"],
        cats : [{name : "tom", age : 99},{name : "jack", age : 99}],
        eat : function(){
            document.write("吃饭");
        }
    };
    document.write("姓名:"+person.name+"<br>"+"年龄:"+person.age+"<br>"+"爱好:"+person.hobby[0]+"<br>");

    person.eat();
</script>
</html>